﻿@model BskLeague.Models.Stadium

@{
    ViewBag.Title = "Stadion :: " + @Model.stadiumName;
}

<script type="text/javascript">
    var mapa;
    var dymek = new google.maps.InfoWindow();

    $(function () {
        $('.stadium_photo').lightBox();
    });

    function dodajMarker(lat, lng, txt) {
        var opcjeMarkera = {
            position: new google.maps.LatLng(lat, lng),
            map: mapa
        }

        var marker = new google.maps.Marker(opcjeMarkera);
        marker.txt = txt;

        google.maps.event.addListener(marker, "click", function () {
            dymek.setContent(marker.txt);
            dymek.open(mapa, marker);
        });

        return marker;
    }

    function mapaStart() {
        var posX = '@Model.stadiumPosX';
        var posY = '@Model.stadiumPosY';
        posX = posX.replace(",", ".");
        posY = posY.replace(",", ".");        

        var wspolrzedne = new google.maps.LatLng(posY, posX);
        var opcjeMapy = {
            zoom: 16,
            center: wspolrzedne,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        mapa = new google.maps.Map(document.getElementById("mapka"), opcjeMapy);
        var marker1 = dodajMarker(parseFloat(posY), parseFloat(posX), '<strong>@Model.stadiumName</strong><br />@Model.stadiumAddressStreet<br />@Model.stadiumAddressCity');

        google.maps.event.trigger(marker1, 'click');
    }
</script>

<p>@Html.ActionLink("Powrót do listy...", "Index")</p>

<h2>
    @Model.stadiumName
    @if (User.IsInRole("Admin"))
    {
        <a href='@Url.Action("Edit", new { id = @Model.stadiumId })'>
            <img src='../../Content/images/edit-icon.png' title='edytuj' alt='edytuj' />
        </a>
        <a href="javascript:if(confirm('Na pewno usunąć?')){window.location='/Stadium/Delete/@Model.stadiumId'}">
            <img src='../../Content/images/delete-icon.png' title='usuń' alt='usuń' />
        </a>
    }    
</h2>

<div class="stadium_details_content">    <a class="stadium_photo" href="@(Model.stadiumPhotoUrl == "" ? "/../Content/images/user_photo/default.jpg" : Model.stadiumPhotoUrl)" title="@Model.stadiumName">        <img class="stadium_photo_thumb" src="@(Model.stadiumPhotoUrl == "" ? "/../Content/images/user_photo/default.jpg" : Model.stadiumPhotoUrl)" title="@Model.stadiumName" alt="@Model.stadiumName" />    </a>

    <strong>
        <p class="stadium_address">@Model.stadiumAddressStreet<br />@Model.stadiumAddressCity</p>
    </strong></div>
<div id="mapka" class="stadium_map"></div>
